package com.yanqu.road.entity.activity.horserun;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@FieldTypeAnnotation(tableName = "t_u_horse_run_activity_gaming_data")
public class HorseRunUserGamingData extends DataObject {
    @FieldTypeAnnotation(select = true,update = true,desc = "活动id")
    private int activityId;
    @FieldTypeAnnotation(select = true,update = true,desc = "用户id")
    private long userId;
    @FieldTypeAnnotation(desc = "当前大进度id -1未开始 0开始")
    private int processId;
    @FieldTypeAnnotation(desc = "小关卡id,从1开始 0为未开始")
    private int stageId;
    @FieldTypeAnnotation(desc = "当前正在处理的事件id")
    private int eventId;
    @FieldTypeAnnotation(desc = "事件处理状态 0未处理1处理中2已处理")
    private int eventState;
    @FieldTypeAnnotation(desc = "累计经验值")
    private int sumExp;
    @FieldTypeAnnotation(desc = "开启倍数")
    private int openGameMultiple;
    @FieldTypeAnnotation(desc = "场景")
    private int backGround;
    @FieldTypeAnnotation(desc = "事件类型触发次数")
    private Map<Integer,Integer> eventTypeTriggerTimes;

    @FieldTypeAnnotation(desc = "局内基础属性值 初始同游戏外 事件等各种加成后 不带出游戏")
    private Map<Integer,Integer> gamingBaseAttr;

    @FieldTypeAnnotation(desc = "局内总属性值 包括技能加成了")
    private Map<Integer,Integer> gamingTotalAttr;

    @FieldTypeAnnotation(desc = "技能 开局就要固定")
    private List<Integer> skill;

    @FieldTypeAnnotation(desc = "当前游戏内评分")
    private long gamingGrade;
    @FieldTypeAnnotation(desc = "事件列表,天数,事件")
    private Map<Integer,List<List<Integer>>> eventMap;
    @FieldTypeAnnotation(desc = "翻牌事件位置结果 缓存")
    private Map<Integer,Integer> cardEventMap;
    @FieldTypeAnnotation(desc = "剩余冒险次数")
    private int remainExploreTime;

    @FieldTypeAnnotation(desc = "当前信心")
    private int nowConfident;
    @FieldTypeAnnotation(desc = "信心最大上限值")
    private int maxConfident;
    @FieldTypeAnnotation(desc = "当前进度固定经验事件stageId")
    private List<Integer> expEventStage;

    @FieldTypeAnnotation(desc = "二选一事件属性类型")
    private int chooseOneEventAttrType;
    @FieldTypeAnnotation(desc = "对方小马id")
    private int battleHorseId;
    @FieldTypeAnnotation(desc = "本次解锁的新装备")
    private List<Integer> unlockNewEquip;

    public int getActivityId() {
        return activityId;
    }
    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public long getUserId() {
        return userId;
    }
    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }
    }

    public int getProcessId() {
        return processId;
    }
    public void setProcessId(int processId) {
        if (this.processId != processId) {
            this.processId = processId;
            setOp(DataStatus.Update);
        }
    }

    public int getStageId() {
        return stageId;
    }
    public void setStageId(int stageId) {
        if (this.stageId != stageId) {
            this.stageId = stageId;
            setOp(DataStatus.Update);
        }
    }

    public int getEventId() {
        return eventId;
    }
    public void setEventId(int eventId) {
        if (this.eventId != eventId) {
            this.eventId = eventId;
            setOp(DataStatus.Update);
        }
    }

    public int getEventState() {
        return eventState;
    }
    public void setEventState(int eventState) {
        if (this.eventState != eventState) {
            this.eventState = eventState;
            setOp(DataStatus.Update);
        }
    }

    public int getSumExp() {
        return sumExp;
    }
    public void setSumExp(int sumExp) {
        if (this.sumExp != sumExp) {
            this.sumExp = sumExp;
            setOp(DataStatus.Update);
        }
    }

    public int getOpenGameMultiple() {
        return openGameMultiple;
    }
    public void setOpenGameMultiple(int openGameMultiple) {
        if (this.openGameMultiple != openGameMultiple) {
            this.openGameMultiple = openGameMultiple;
            setOp(DataStatus.Update);
        }
    }

    public int getBackGround() {
        return backGround;
    }
    public void setBackGround(int backGround) {
        if (this.backGround != backGround) {
            this.backGround = backGround;
            setOp(DataStatus.Update);
        }
    }

    public Map<java.lang.Integer, java.lang.Integer> getEventTypeTriggerTimes() {
        return eventTypeTriggerTimes;
    }
    public void setEventTypeTriggerTimes(Map<java.lang.Integer, java.lang.Integer> eventTypeTriggerTimes) {
        if (null == eventTypeTriggerTimes){
            return;
        }
        if (this.eventTypeTriggerTimes == null || !this.eventTypeTriggerTimes.equals(eventTypeTriggerTimes)) {
            this.eventTypeTriggerTimes = eventTypeTriggerTimes;
            setOp(DataStatus.Update);
        }
    }

    public Map<java.lang.Integer, java.lang.Integer> getGamingBaseAttr() {
        return gamingBaseAttr;
    }
    public void setGamingBaseAttr(Map<java.lang.Integer, java.lang.Integer> gamingBaseAttr) {
        if (null == gamingBaseAttr){
            return;
        }
        if (this.gamingBaseAttr == null || !this.gamingBaseAttr.equals(gamingBaseAttr)) {
            this.gamingBaseAttr = gamingBaseAttr;
            setOp(DataStatus.Update);
        }
    }

    public Map<java.lang.Integer, java.lang.Integer> getGamingTotalAttr() {
        return gamingTotalAttr;
    }
    public void setGamingTotalAttr(Map<java.lang.Integer, java.lang.Integer> gamingTotalAttr) {
        if (null == gamingTotalAttr){
            return;
        }
        if (this.gamingTotalAttr == null || !this.gamingTotalAttr.equals(gamingTotalAttr)) {
            this.gamingTotalAttr = gamingTotalAttr;
            setOp(DataStatus.Update);
        }
    }

    public List<java.lang.Integer> getSkill() {
        return skill;
    }
    public void setSkill(List<java.lang.Integer> skill) {
        if (null == skill){
            return;
        }
        if (this.skill == null || !this.skill.equals(skill)) {
            this.skill = skill;
            setOp(DataStatus.Update);
        }
    }

    public long getGamingGrade() {
        return gamingGrade;
    }
    public void setGamingGrade(long gamingGrade) {
        if (this.gamingGrade != gamingGrade) {
            this.gamingGrade = gamingGrade;
            setOp(DataStatus.Update);
        }
    }

    public Map<java.lang.Integer, List<List<java.lang.Integer>>> getEventMap() {
        return eventMap;
    }
    public void setEventMap(Map<java.lang.Integer, List<List<java.lang.Integer>>> eventMap) {
        if (null == eventMap){
            return;
        }
        if (this.eventMap == null || !this.eventMap.equals(eventMap)) {
            this.eventMap = eventMap;
            setOp(DataStatus.Update);
        }
    }

    public Map<java.lang.Integer, java.lang.Integer> getCardEventMap() {
        return cardEventMap;
    }
    public void setCardEventMap(Map<java.lang.Integer, java.lang.Integer> cardEventMap) {
        if (null == cardEventMap){
            return;
        }
        if (this.cardEventMap == null || !this.cardEventMap.equals(cardEventMap)) {
            this.cardEventMap = cardEventMap;
            setOp(DataStatus.Update);
        }
    }

    public int getRemainExploreTime() {
        return remainExploreTime;
    }
    public void setRemainExploreTime(int remainExploreTime) {
        if (this.remainExploreTime != remainExploreTime) {
            this.remainExploreTime = remainExploreTime;
            setOp(DataStatus.Update);
        }
    }

    public int getNowConfident() {
        return nowConfident;
    }
    public void setNowConfident(int nowConfident) {
        if (this.nowConfident != nowConfident) {
            this.nowConfident = nowConfident;
            setOp(DataStatus.Update);
        }
    }

    public int getMaxConfident() {
        return maxConfident;
    }
    public void setMaxConfident(int maxConfident) {
        if (this.maxConfident != maxConfident) {
            this.maxConfident = maxConfident;
            setOp(DataStatus.Update);
        }
    }

    public List<java.lang.Integer> getExpEventStage() {
        return expEventStage;
    }
    public void setExpEventStage(List<java.lang.Integer> expEventStage) {
        if (null == expEventStage){
            return;
        }
        if (this.expEventStage == null || !this.expEventStage.equals(expEventStage)) {
            this.expEventStage = expEventStage;
            setOp(DataStatus.Update);
        }
    }



    public int getChooseOneEventAttrType() {
        return chooseOneEventAttrType;
    }
    public void setChooseOneEventAttrType(int chooseOneEventAttrType) {
        if (this.chooseOneEventAttrType != chooseOneEventAttrType) {
            this.chooseOneEventAttrType = chooseOneEventAttrType;
            setOp(DataStatus.Update);
        }
    }

    public int getBattleHorseId() {
        return battleHorseId;
    }
    public void setBattleHorseId(int battleHorseId) {
        if (this.battleHorseId != battleHorseId) {
            this.battleHorseId = battleHorseId;
            setOp(DataStatus.Update);
        }
    }

    public List<Integer> getUnlockNewEquip() {
        return unlockNewEquip;
    }

    public void setUnlockNewEquip(List<Integer> unlockNewEquip) {
        if (null == unlockNewEquip){
            return;
        }
        if (this.unlockNewEquip == null || !this.unlockNewEquip.equals(unlockNewEquip)) {
            this.unlockNewEquip = unlockNewEquip;
            setOp(DataStatus.Update);
        }
    }

    /**
     * 获取天数
     * @return
     */
    public int getDay(){
        return 8 * processId + stageId;
    }

    /**
     * 增加基础属性
     * @param type
     * @param value
     */

    public void addBaseAttr(int type,int value){
        gamingBaseAttr.put(type,gamingBaseAttr.get(type)+value);
        setUpdateOption();
    }

    /**
     * 加经验
     * @param exp
     */

    public void addExpSum(int exp){
        this.sumExp+=exp;
        setUpdateOption();
    }

    /**
     * 扣除信心值
     * @return
     */
    public void reduceConfident(int num){
        setNowConfident(getNowConfident()-num);
        setUpdateOption();
    }

    /**
     * 增加事件类型遇到次数
     * @return
     */
    public void addEventTypeTime (int type,int num){
        Map<Integer,Integer> tempMap = new ConcurrentHashMap<Integer,Integer>(eventTypeTriggerTimes);
        if (tempMap.containsKey(type)){
            tempMap.put(type,tempMap.get(type)+num);
        }else {
            tempMap.put(type,num);
        }
        setEventTypeTriggerTimes(tempMap);
        setUpdateOption();
    }

    /**
     * 获取某个事件遇到次数
     * @return
     */
    public int getEventMeetTime(int type){
        if (eventTypeTriggerTimes.containsKey(type)){
            return eventTypeTriggerTimes.get(type);
        }else {
            return 0;
        }
    }
    
}
